package com.frame.easy.modular.activiti.controller;

import com.frame.easy.base.controller.BaseController;
import com.frame.easy.modular.activiti.model.Historic;
import com.frame.easy.modular.activiti.service.HistoricService;
import com.frame.easy.result.Tips;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 流程历史活动记录
 *
 * @author tengchong
 * @date 2020/5/7
 */
@Controller
@RequestMapping("/auth/activiti/historic")
public class HistoricController extends BaseController {

    @Autowired
    private HistoricService service;




    /**
     * 查询数据
     *
     * @param historic 查询条件
     * @return 数据
     */
    @RequestMapping("select")
    @ResponseBody
    public Tips select(Historic historic) {
        logger.debug("/auth/activiti/historic/select");
        return Tips.getSuccessTips(service.select(historic));
    }

    /**
     * 根据业务id查询流程实例
     *
     * @param businessKey 业务id
     * @return 流程实例
     */
    @RequestMapping("select/task/{businessKey}")
    @ResponseBody
    public Tips selectTask(@PathVariable("businessKey") String businessKey){
        return Tips.getSuccessTips(service.selectTask(businessKey));
    }
}
